$(function() {
	$('#vue_vm_list div').hide();
});

var donate = {
	donateId: '',
	donateName: '',
	contactPhoneNumber: '',
	contactName: '',
	donateDate: '',
	donateDecr: '',
	donateTo: '',
	createTime: '',
	updateTime: '',
	createId: getLoginedUser()? getLoginedUser().staffId: '',
	updateId: getLoginedUser()? getLoginedUser().staffId: '',
};

var view = {
	data: donate
};

var vue_vm = new Vue({
	el: '#vue_vm',
	data: view
});

findAll();

function save() {
	view.data.donateDate = $('#donateYear').val() + '-' + $('#donateMonth').val() + '-' + $('#donateDay').val();
	
	save_basic(path+'/donate/save', {donate:view.data}, function() {
		alert('捐赠登记成功');
	});
}

function findAll() {
	if($('#vue_vm_list').length==0) {return;}
	$('#vue_vm_list div').hide();

	findAll_basic(path+'/donate/findAll', function(response) {
		$('#vue_vm_list').html(gl_vue_vm_list_html);
		
		new Vue({
			el: '#vue_vm_list',
			data: {
				todos: response.data
			}
		});
		
		$('#vue_vm_list div').show();
	});
}

function deleteBatch() {
	deleteBatch_basic(path+'/donate/deleteBatch');
}
